#!/bin/bash 

source ./test.cfg

DEBUG=0

if [ -z $1 ]; then
  NODE=msserver01a
  ID=APP1
  TOPIC=\$SharedSubscription/dog//APP/a01/#
else
  NODE=${APPLIANCE[$1]}
  ID=${APP[$1]}
  TOPIC=${SHARED}/APP/${ID}/#
fi

ID=C00000014
RESENDID=C00000024
PW=svtpvtpass
ENDPOINT=`/niagara/test/scripts/getclusterserverendpointport.py -c ${CLUSTER} -e SVT-IntranetEndpoint -a ${NODE}`
gatherpubserver=tcp://${ENDPOINT}
subserver=tcp://${ENDPOINT}

if [ ${DEBUG} -ne 0 ]; then
  echo CLUSTER=${CLUSTER}
  echo NODE=${NODE}
  echo ENDPOINT=${ENDPOINT}
  echo QOS=${QOS}
  echo MESSAGES=${MESSAGES}
fi


echo test_template5_JMSClient -a subscribe -t "/svtGroup0/chat" -s ${subserver} -v -b -u u0000014 -p imasvtest -Nm 1 -resendURI ${gatherpubserver} -resendID u0000024 -debug -resendTopic /svtGroup0/chat/gather -shared dog


echo java svt.mqtt.mq.MqttSample -vv -debug -a subscribe -mqtt 3.1.1 -q ${QOS} -t '$SharedSubscription/dog//svtGroup0/chat' -s ${subserver} -i ${ID} -u ${ID} -p svtpvtpass -v -c false  -Nm ${MINUTES} -resendURI ${gatherpubserver} -resendID ${RESENDID} -resendTopic /svtGroup0/chat/gather
java svt.mqtt.mq.MqttSample -vv -debug -a subscribe -mqtt 3.1.1 -q ${QOS} -t '$SharedSubscription/dog//svtGroup0/chat' -s ${subserver} -i ${ID} -u ${ID} -p svtpvtpass -v -c false  -Nm ${MINUTES} -resendURI ${gatherpubserver} -resendID ${RESENDID} -resendTopic /svtGroup0/chat/gather -maxInflight 32000
